﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AmuTools;
using app.Api;
namespace app.Models
{
    [Model(TableName = "t_listed_company", PrimaryKey = "id", IdentityInsert = false)]
    public class ListedCompany : ModelBase
    {
        [Field(Description = "上市企业信息的唯一标识")]
        public int id { get; set; }

        [Field(Description = "上市企业信息的唯一编号：lc+时间戳+企业id/管理员id")]
        public string number { get; set; }

        [Field(Description = "上市企业的标识")]
        public int company_id { get; set; }

        [Field(Description = "上市企业名称")]
        public string company_name { get; set; }

        [Field(Description ="总股本，单位万元")]
        public int total_equity { get; set; }

        [Field(Description = "国有股本，单位万元")]
        public int state_owned_shares { get; set; }

        [Field(Description = "法人股，单位万元")]
        public int legal_person_share { get; set; }

        [Field(Description = "自然人股，单位万元")]
        public int natural_person_shares { get; set; } 

        [Field(DataType ="varchar(10)",Description ="控股股东")]
        public string controlling_shareholder { get; set; }

        [Field(Description = "标识境内还是境外板块")]
        public string board { get; set; }

        [Field(Description = "上市板块")]
        public string listed_sector { get; set; }

        [Field(Description = "企业性质")]
        public string enterprise_nature { get; set; } 

        [Field(Description = "保荐机构（人）")]
        public string sponsor { get; set; }

        [Field(Description = "辅导机构")]
        public string counselling_organization { get; set; }

        [Field(Description = "上市状态：拟上市和已上市两种状态")]
        public string list_status { get; set; }

        [Field(Description = "注册资本，单位万元")]
        public int registered_capital { get; set; }

        [Field(Description = "注册地址")]
        public string registerde_address { get; set; }

        [Field(Description = "设立时间")]
        public string create_time { get; set; }

        [Field(Description = "法人代表")]
        public string legal_representative { get; set; }

        [Field(Description = "联系人")]
        public string contact_person { get; set; }

        [Field(Description = "移动电话")]
        public string mobile_phone { get; set; }

        [Field(Description = "办公电话")]
        public string office_phone { get; set; }

        [Field(Description = "所属行业")]
        public string industry_involved { get; set; }

        [Field(Description = "主营业务")]
        public string main_business { get; set; }

        [Field(Description = "是否为高新技术企业")]
        public string high_tech_enterprise { get; set; }

        [Field(Description = "是否省级扶贫龙头企业")]
        public string Anti_poverty_leading_enterprise{ get; set; }

        [Field(Description = "贫困县等级")]
        public string poverty_level { get; set; }

        [Field(Description = "改制时间")]
        public string restructurt_time { get; set; }

        [Field(Description = "股份公司设立形式")]
        public string corporation_set_up_form { get; set; }

        [Field( Description = "时间安排")]
        public string schedule { get; set; }

        [Field(Description = "律师事务所")]
        public string law_firm { get; set; }

        [Field(Description = "会计事务所")]
        public string Account_firm { get; set; }

        [Field(Description = "审核标记：0未审核  1审核通过   2审核未通过 ，审核未通过和未审核状态下允许用户对资料进行修改")]
        public string status { get; set; } 

        static public Dictionary<string, string> ExcelColumns
        {
            get
            {
                Dictionary<string, string> dic = new Dictionary<string, string>();
                dic.Add("company_name", "公司名称");
                dic.Add("list_status", "上市状态");
                dic.Add("total_equity", "总股本(万元)");
                dic.Add("state_owned_shares", "国有股(万元)");
                dic.Add("legal_person_share", "法人股(万元)");
                dic.Add("natural_person_shares", "自然人股(万元)");
                dic.Add("controlling_shareholder", "控股股东");
                dic.Add("counselling_organization", "辅导机构");
                dic.Add("enterprise_nature", "企业性质");
                dic.Add("sponsor", "保荐机构");
                dic.Add("registered_capital", "注册资本(万元)");
                dic.Add("registerde_address", "注册地址");
                dic.Add("create_time", "设立时间(年)");
                dic.Add("legal_representative", "法人代表");
                dic.Add("contact_person", "联系人");
                dic.Add("mobile_phone", "移动电话");
                dic.Add("office_phone", "办公电话");
                dic.Add("industry_involved", "所属行业");
                dic.Add("main_business", "主营业务");
                dic.Add("high_tech_enterprise", "是否为高新技术企业");
                dic.Add("Anti_poverty_leading_enterprise", "是否省级扶贫龙头企业");
                dic.Add("poverty_level", "贫困县等级");
                dic.Add("restructurt_time", "改制时间(年)");
                dic.Add("corporation_set_up_form", "股份公司设立形式");
                dic.Add("law_firm", "律师事务所");
                dic.Add("Account_firm", "会计事务所");
                dic.Add("listed_sector", "上市板块");
                dic.Add("schedule", "时间安排(年)");
                return dic;
            }
        }

        static public Dictionary<string, Func<object, object>> ExcelColumnsHandle
        {
            get
            {
                Func<object, object> time_handle = value => {
                    return DateTimeEx.TimeStampToDatetime(value.ToString()).Year;
                };
                Dictionary<string, Func<object, object>> dic = new Dictionary<string, Func<object, object>>();
                dic.Add("schedule", time_handle);
                dic.Add("create_time", time_handle);
                dic.Add("restructurt_time", time_handle);
                //dic.Add("list_status", value => {
                //    string[] temp = new string[] { "", "拟上市", "已上市" };
                //    return temp[(int)value];
                //});
                return dic;
            }
        }
    }
}